Solving 10385 - Duathlon (Ternary search)
[andmenj-acm.git] / 11586 - Train tracks / 11586.cpp
blob7250f1edf262866612abbdef9661ad7df3032375
1 /*
2 Problem:
3 Andrés Mejía-Posada (andmej@gmail.com)
4 */
5 using namespace std;
6 #include <algorithm>
7 #include <iostream>
8 #include <iterator>
9 #include <sstream>
10 #include <fstream>
11 #include <numeric>
12 #include <cassert>
13 #include <climits>
14 #include <cstdlib>
15 #include <cstring>
16 #include <string>
17 #include <cstdio>
18 #include <vector>
19 #include <cmath>
20 #include <queue>
21 #include <deque>
22 #include <stack>
23 #include <list>
24 #include <map>
25 #include <set>
27 #define foreach(x, v) for (typeof (v).begin() x = (v).begin(); x != (v).end(); ++x)
28 #define For(i, a, b) for (int i=(a); i<(b); ++i)
29 #define D(x) cout << #x " is " << x << endl
31 int main(){
32 int casos;
33 cin >> casos;
34 string s;
35 getline(cin, s);
36 while (casos--){
37 int m = 0, f = 0;
38 getline(cin, s);
39 stringstream sin(s);
40 while (sin >> s){
41 if (s[0] == 'M') m++; else f++;
42 if (s[1] == 'M') m++; else f++;
44 if (m % 2 == 0 && f % 2 == 0){
45 cout << "LOOP" << endl;
46 }else{
47 cout << "NOT LOOP" << endl;
50 return 0;